package org.example.java.socket.TCP;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.Socket;
import java.util.concurrent.TimeUnit;

public class ReadDataClient {
  public static void main(String[] args) throws Exception {
    Socket client = new Socket("127.0.0.1", 19090);
    BufferedReader dataInputStream = new BufferedReader(new InputStreamReader(client.getInputStream(), "UTF-8"));
    String nextValue = null;
    boolean start = true;
    while (start) {
      while ((nextValue = dataInputStream.readLine()) != null) {
        System.out.println(nextValue);
      }
      TimeUnit.SECONDS.sleep(2);
    }
    dataInputStream.close();
    client.close();

  }
}
